package com.zc.controller;

import com.zc.pojo.Hobby;
import com.zc.service.HobbyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: cong
 * @create: 2025/2/19
 */
@RestController
@Slf4j
public class HobbyController {
    @Autowired
    private HobbyService hobbyService;

    @GetMapping("/getHobby/{id}")
    public Hobby getHobby(@PathVariable int id) {
        Hobby hobby = null;
        try {
            hobby = hobbyService.getHobby(id);
        } catch (Exception e) {
            log.info("查询异常：{}", e.getMessage());
        }
        return hobby;
    }
}
